package com.jiudengnile.dr.web.action;

import wint.help.biz.result.Result;
import wint.mvc.flow.FlowData;
import wint.mvc.template.Context;

import com.jiudengnile.dr.biz.ao.RecordDataAO;

public class UploadData {
	
	private RecordDataAO recordDataAO;
	
	public void execute(FlowData flowData, Context context) {
		flowData.setViewType("json");
		String uid = flowData.getParameters().getString("uid");
		String data = flowData.getParameters().getString("data");
		Result result = recordDataAO.recordData(uid, data);
		if (result.isSuccess()) {
			context.put("result", "success");
			context.put("count", result.getModels().get("count"));
		} else {
			context.put("result", "failed");
			context.put("resultcode", result.getResultCode());
		}
	}

	public void setRecordDataAO(RecordDataAO recordDataAO) {
		this.recordDataAO = recordDataAO;
	}

}
